package com.rpay.web.interceptor.authentic;

import com.rpay.web.interceptor.authentic.strategy.AccessTokenControl;
import com.rpay.web.interceptor.authentic.strategy.BaseAccessControl;
import com.rpay.web.interceptor.authentic.strategy.SecretControl;

/**
 * Title：
 * Description
 *
 * @author fxg06 on 2018/4/19
 * @version 1.0
 */
public enum AccessControlType {
    /**
     *  app 密钥鉴权
     */
    SECRET("secret", new SecretControl(), 1),
    /**
     * accessToken鉴权, 用户必须登录
     */
    ACCESS_TOKEN("accessToken", new AccessTokenControl(), 2);

    private String paramName;

    private BaseAccessControl baseAccessControl;

    /**
     * 优先级（执行顺序）
     */
    private int order;


    AccessControlType(String value, BaseAccessControl baseAccessControl, int order) {
        this.paramName = value;
        this.baseAccessControl = baseAccessControl;
        this.order = order;
    }

    /**
     * Return valid parameter name for current type.
     *
     * @return String.
     */
    public String paramName() {
        return this.paramName;
    }

    public Integer order() {
        return this.order;
    }

    public BaseAccessControl getBaseAccessControl() {
        return baseAccessControl;
    }
}
